package com.jewelry.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.jewelry.dao.IConfigurationDAO;
import com.jewelry.service.IConfigurationService;
import com.jewelry.vo.ConfigurationVO;

public class ConfigurationServiceImpl implements IConfigurationService {
	
	private static Logger logger = LoggerFactory.getLogger(ConfigurationServiceImpl.class);
	
	private IConfigurationDAO configurationDAO;

	public IConfigurationDAO getConfigurationDAO() {
		return configurationDAO;
	}

	public void setConfigurationDAO(IConfigurationDAO configurationDAO) {
		this.configurationDAO = configurationDAO;
	}
	
	//===================================================================

	@Override
	public int getConfigCount(int configid) {
		if(logger.isDebugEnabled()){
			logger.debug("Start getConfigCount ... ");
		}
		ConfigurationVO vo = new ConfigurationVO();
		vo.setConfigid(configid);
		return configurationDAO.getConfigCount(vo);
	}
	
	public List<ConfigurationVO> getConfigList() {
		ConfigurationVO	configurationVO = new ConfigurationVO();
		int totalItem = configurationDAO.getConfigCount(configurationVO);
		configurationVO.getPage().setTotalItem(totalItem);
		return configurationDAO.getConfigList(configurationVO);
	}

	@Override
	public List<ConfigurationVO> getConfigListByPage(ConfigurationVO vo) {
		int totalItem = configurationDAO.getConfigCount(vo);
		vo.getPage().setTotalItem(totalItem);
		return configurationDAO.getConfigList(vo);
	}

	@Override
	public ConfigurationVO getConfigInfoByid(int configid) {
		return configurationDAO.getConfigInfoByid(configid);
	}
	
	

}
